﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("basePath", basePath);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'Page.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<jsp:include page="/scripts/common/index.html"></jsp:include>
<jsp:include page="/scripts/jquery/index.html"></jsp:include>
<jsp:include page="/scripts/dhtmlx/index.html"></jsp:include>
<jsp:include page="/scripts/bootstrap/index.html"></jsp:include>
<link rel="stylesheet" href="${basePath }style/default.css">
<script>
	var myGrid,treeName,treeId;
	function init() {
		clickFun();
		addNode();
		initData();
		initEvent();
	}
	function initData() {
		query();
	}
	function initEvent() {
		initDateTime();
	}
	function initDateTime(){
		var myDate=new Date();
		//alert(myDate.getFullYear() + "-" + (myDate.getMonth()+1) + "-" + myDate.getDate());
		$("#endTime").val(myDate.getFullYear() + "-" + (myDate.getMonth()+1) + "-" + myDate.getDate());
		//myDate.setMonth(myDate.getDate()-1);
		myDate.setDate(myDate.getDate()-1)
		//alert(myDate.getFullYear() + "-" + (myDate.getMonth()+1) + "-" + myDate.getDate());
		$("#startTime").val(myDate.getFullYear() + "-" + (myDate.getMonth()+1) + "-" + myDate.getDate());
	}
	//日期
	function setCalendar() {
		//var startCal = new dhtmlxCalendarObject("validStartDate");
		var endCal = new dhtmlxCalendarObject("endTime");
		endCal.loadUserLanguage("zh");
		var s = $("#startTime").val();
		endCal.setInsensitiveRange(null, s);
		endCal.setDate(s);
	}
	$(function() {
		var startCal = new dhtmlXCalendarObject({
			input : "startTime" ,
			button : "calendar_icon"
		});
		startCal.loadUserLanguage("zh");
		var endCal = new dhtmlXCalendarObject({
			input : "endTime" ,
			button : "calendar_icon"
		});
		endCal.loadUserLanguage("zh");
	});
	function addNode() {
		var str = "<div id='example5' class='ezmodal'></div><input type='text' id='sucessUrl' style='display:none'/>";
		$("body").append(str);
	}
	function clickFun() {
	
		//重置
		$("#repeat").click(function() {
			window.location.reload();

			initDateTime();
		});
		//刷新
		$("#refresh").click(function() {
			query();
		});
	}
	//重置查询框
	function clearData() {
		var arr = ['staffName'];
		for(var key in arr){
			$('#' + arr[key]).val("");
		}
	}
	function query(){
		var v = getValue();
		var arr = [
            'staffName',
			'startTime',
			'endTime'
		];
		$.each(arr, function(key, val) {
			v["map." + val] = $("#" + val).val();
		});
		$.ajax({
			type : 'POST' ,
			url : 'page/system/log/Log/query' ,
			data : v ,
			dataType : "json" ,
			async : true ,
			cache : false ,
			jsonpCallback : "null" ,
			//beforeSend : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			//dataFilter : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			success : function(response, status, statusText) {
				console.debug(response);
				if (response.status) {
					var a = response.content.currentPageNum;
					var b = response.content.allPageNum;
					var c = response.content.allCount;
					setValue(a, b, c);
				} else {
					alert(response.content);
				}
			} ,
			error : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			} ,
			complete : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			}
		});
	}
</script>

</head>
<style>
.fv-form-bootstrap .help-block {
	width: 0px;
	height: 0px;
}
.form-group .col-xs-1{
width: 10%;
}
.form-group .col-xs-2{
padding-top: 5px;
width: 15%;
}
.form-horizontal .form-group{
margin-bottom:5px;
margin-left:0px;
width: 95%;
}
</style>
<body onload="init()">
	<form class="form-horizontal MyForm" id="MyForm" name="MyForm" method="post" target="MyFrame" enctype="multipart/form-data">
		<table class="listTableClass" border="0" cellpadding="0" cellspacing="0">
			<tr class="queryClass">
				<td>
					<table>
						<tr>
							<td class="contClass">
							<div class="form-group">
								<label class="col-xs-1 control-label" style="width: 80px;">操作人：</label>
								<div class="col-xs-2 ">
									<input class=" form-control" type="text" name="map.staffName" id="staffName" />
								</div>
								<label class="col-xs-1 control-label" style="width: 80px;">操作时间：</label>
								<div class="col-xs-2 ">
									<input class="Date form-control" type="text" name="map.startTime" id="startTime"  onblur="setCalendar();" readonly/>
								</div>
								<label class="col-xs-1 control-label" style="width: 25px;">---</label>
								 <div class="col-xs-2 ">
									<input class="Date form-control" type="text" name="map.endTime" id="endTime"  placeholder="" readonly>
								</div>
								<div class="col-xs-2" >
									<button onclick="query()" class="btn btn-primary" type="button">
									<span>查询</span>
									</button>
									<button onclick="clearData()" class="btn btn-primary" type="reset">
										<span>清空</span>
									</button>
								</div>
							</div>		
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr class="listTrClass">
				<td>
					<table class="listTableClass">
						<tr class="listContClass">
							<td>
								<div>
									<button class="btn btn-primary" type="button" id="refresh">
										<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> &nbsp; <span>刷新</span>
									</button>
									<button class="btn btn-primary" type="button" id="repeat">
										<span class="glyphicon glyphicon-repeat" aria-hidden="true"></span> &nbsp; <span>重置</span>
									</button>
								</div>
							</td>
						</tr>
						<tr class="listTrClass">
							<td><jsp:include page="/common/grid_toolbar.jsp">
									<jsp:param value="query" name="func" />
									<jsp:param value="setValue" name="setValue" />
									<jsp:param value="getValue" name="getValue" />
									<jsp:param value="getGrid" name="getGrid" />
									<jsp:param value="getGridSelectValues" name="getGridSelectValues" />
									<jsp:param value="true" name="isPaging" />
								</jsp:include></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
